//
//  WKMessgeViewController.m
//  WKMaybell
//
//  Created by 何文虎 on 2019/3/1.
//  Copyright © 2019 何文虎. All rights reserved.
//

#import "WKMessgeViewController.h"
#import "JXCategoryView.h"
#import "WKNotificationView.h"

@interface WKMessgeViewController ()<JXCategoryViewDelegate,UIScrollViewDelegate>
{
     NSArray *_titleArr;
    UIScrollView *_scrollView;
    WKNotificationView *notificationView;
}
@property (nonatomic, strong) JXCategoryTitleView *categoryView;
@end

@implementation WKMessgeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViews];
}


- (void)initViews{
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.naviBar.title = @"消息";
    _titleArr = @[@"评论",@"赞",@"通知"];
    
    _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavBarHeight+44, ScreenWidth, ScreenHeight-NavBarHeight-44)];
    _scrollView.delegate = self;
    _scrollView.pagingEnabled = YES;
    _scrollView.contentSize = CGSizeMake(ScreenWidth*_titleArr.count, 0);
    _scrollView.bounces = NO;
    [self.view addSubview:_scrollView];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    if (@available(iOS 11.0, *)) {
        _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
    
    
    
    for (int i = 0; i<_titleArr.count; i++) {
      
        WKNotificationView *view = [[WKNotificationView alloc]initWithFrame:CGRectMake(ScreenWidth*i, 0, ScreenWidth, ScreenHeight-NavBarHeight-44)];
        [_scrollView addSubview:view];
    }
    
    
    self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, NavBarHeight, ScreenWidth, 44)];
    [self.view addSubview:self.categoryView];
    self.categoryView.titles = _titleArr;
    self.categoryView.backgroundColor = [UIColor whiteColor];
    self.categoryView.delegate = self;
    self.categoryView.titleSelectedColor = BACK_COLOR;
    self.categoryView.titleColor = UIColorFromHex(0x3C3C3C);
    self.categoryView.titleFont = PFSC_MediumFont(15);
    self.categoryView.titleColorGradientEnabled = NO;
    self.categoryView.titleLabelZoomEnabled = NO;
    self.categoryView.contentScrollView =_scrollView;
   
}



- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
  
}

#pragma mark - JXPagerViewDelegate


#pragma mark - JXCategoryViewDelegate

- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
    self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}







@end
